package org.naivecode.audio;

import junit.framework.Assert;

import org.junit.Test;

public class TestLinearSequence {
	@Test
	public void testRegression() {
		final float slope = 0.5f;
		final float shift = 10;
		final int start = 5;
		final LinearSequence ls = new LinearSequence(start);
		for (int i = start; i <= 10 + start; i++) {
			ls.append(new Extremum(shift + slope * i + 0.5f, 1));
		}
		Assert.assertEquals(shift, ls.getCenterLine().getShift(), 0.001);
		Assert.assertEquals(slope, ls.getCenterLine().getSlope(), 0.001);
	}
}
